﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="ManagerDepartment.aspx.cs" Inherits="MyHospital.web.ManagerDepartment" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <div id="login" class="login">
             <!-- 登陆框标题 -->
             <div id="login-title" class="login-title">
                增加科室  
                 <span><a id="closeBtn" href="javascript:void(0)">关闭</a></span>
             </div>
            <!-- 登陆框表单 -->
           <div id="login-form">
                    <div class="login-input">
                        <label>科室名：</label>
                        <asp:TextBox ID="txtName" class="list-input" runat="server" Text="" ></asp:TextBox>
                    </div>
                    <div class="login-input">
                        <label>简&nbsp;&nbsp;介：</label>
                        <asp:TextBox ID="txtDec" class="list-input" runat="server" Text=""></asp:TextBox>
                    </div>
                </div>
                <!-- 登陆框登陆按钮 -->
                    <asp:Button ID="submit" class="loginSubmit" runat="server" Text="添加科室" OnClick="InsertSubmit"/>
                     <asp:Label ID="Label2" runat="server" Text=""></asp:Label>
            </div>
            <!-- 遮盖层 -->
            <div id="bg" class="bg">sada</div>
        
                
    科室名称:<asp:TextBox ID="txtDepartmentName" runat="server" Text=""></asp:TextBox>
&nbsp;<asp:Button ID="Search" runat="server" Text="搜索" OnClick="SearcheDepartment"/>
    &nbsp;&nbsp;&nbsp;
    <asp:Button ID="Back" runat="server" Text="取消" OnClick="SearchBack"/>
    <br />
     <br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="departId" HorizontalAlign="Center" DataSourceID="LinqDataSource1" >
        <Columns>
            <asp:BoundField DataField="departId" HeaderText="部门编号" InsertVisible="False" ReadOnly="True" SortExpression="departId" ItemStyle-Width="60px" ItemStyle-Height="30px" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center" Height="30px" Width="80px"></ItemStyle>
            </asp:BoundField>
            <asp:BoundField DataField="departName" HeaderText="部门名称" SortExpression="departName" ItemStyle-Width="300px" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center" Width="300px"></ItemStyle>
            </asp:BoundField>
            <asp:BoundField DataField="introduce" HeaderText="部门简介" SortExpression="introduce" ItemStyle-Width="1000px" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center" Width="1000px"></ItemStyle>
            </asp:BoundField>
            <asp:TemplateField ItemStyle-Width="40px">
                    <ItemTemplate>
                        <input type="radio" name="myRadio" value='<%# Container.DataItemIndex.ToString() %>'>
                    </ItemTemplate>

<ItemStyle Width="40px"></ItemStyle>
                </asp:TemplateField>
            <asp:CommandField ShowEditButton="True" ItemStyle-Width="160px" EditText="修改" UpdateText="修改">
<ItemStyle Width="160px"></ItemStyle>
            </asp:CommandField>
        </Columns>
    </asp:GridView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MyHospital.DAL.MyHospitalDataContext" EntityTypeName="" TableName="Department" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
    </asp:LinqDataSource>

     <br />
    <script type="text/javascript">
            function setNowRadio(v)
            {
                //alert(v);
                var myForm,objRadio;
                myForm=document.forms[0];
                for(var i=0;i<myForm.length;i++)
                {
                    if(myForm.elements[i].type=="radio")
                    {
                        objRadio=myForm.elements[i];
                        //alert(objRadio.name);
                        //alert(objRadio.value);
                        if(objRadio.value==v)
                        {
                            objRadio.checked=true;
                        }
                    }
                }
            }
            <asp:Literal ID="jsLiteral" runat="server"></asp:Literal>
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <style type="text/css">
               *{
                   margin: 0px;
                   padding: 0px;
              }
              /* 弹出登陆框按钮 */
              #login-header{
                  text-align: center;
                  height: 30px;
                  line-height: 30px;
              }
              #login-header a{
                  font-size: 24px;
                  text-decoration: none;
                  color: black;
              }
             
              /* 登陆框主体 */
              .login{
                  position: absolute;
                  width: 800px;
                  height: 350px;
                  z-index: 9999;
                  display: none;
                  background-color: #8c8ea3;
                  /* 这里要注意绝对定位的盒子怎么在屏幕显示居中 */
                  left: 50%;
                  margin-left: -420px;
                  margin-top: 50px;
                  border: 1px solid gray;
              }
              /* 登陆框标题 */
              .login-title{
                  width: 100%;
                  height: 40px;
                  line-height: 40px;
                  text-align: center;
                  margin-bottom: 20px;
                  cursor: move;
              }
              .login-title span a{
                  text-decoration: none;
                  border: 1px solid gray;
                 font-size: 12px;
                 color: black;
                 border-radius: 20px;
                 width: 40px;
                 height: 40px;
                 background-color: #fff;
                 position: absolute;
                 top: -20px;
                 right: -20px;
             }
             
             /* 登陆表单 */
             .login-input{
                  margin: 20px 0px 30px 0px;
             }
             .login-input label{
                 float: left;
                 height: 35px;
                 line-height: 35px;
                width: 90px;
                padding-left: 10px;
                 text-align: right;
                 font-size: 14px;
             }
             .login-input input.list-input{
                 height: 35px;
                line-height: 35px;
                width: 350px;
                  text-indent: 5px;
             }
             #txtName{
                 height: 35px;
                line-height: 35px;
                width: 350px;
                  text-indent: 5px;
             }
             #txtDec{
                 height: 35px;
                line-height: 35px;
                width: 350px;
                  text-indent: 5px;
             }
              /* 登陆框登陆按钮 */
            .loginSubmit{
               width: 160px;
                height: 30px;
                 text-align: center;
                 border: 1px solid gray;
                  background-color: white;
                margin-left: 120px;
                
              }
              
             /* 遮盖层 */
             .bg{
                 background-color: #000;
                width: 2000px;
                height: 100%;
                 top: 0px;
                position: fixed;
                 opacity: 0.3;
                 display: none;
                 margin-left:-250px;
             }
         </style>
    <table class="Department"  style="margin-top:430px;margin-left:-400px">
        <tr>
            <td>
                <a id="adminBtn" href="javascript:void(0)">
                    <asp:Button ID="Button2" runat="server" Text="增加科室" Width="100px" href="javascript:void(0)"/>
                </a>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp</td>
            <td>
                <a>
              <asp:Button ID="Button3" runat="server" Text="删除科室" Width="100px" OnClick="Button3_Click" OnClientClick="javascript:return confirm('真的要删除吗？');" />
                    </a>
            </td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp</td>
            <td>
                <a>
              
                </a>
            </td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp</td>
            <td>
                <asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
            </td>
           </tr>
        </table>
            <!-- 插入JS代码 -->
            <script type="text/javascript">
                var login = document.getElementById('login');
                //  .点击"点击，弹出登陆框",弹出登陆窗口和遮盖层
                var adminBtn = document.getElementById('adminBtn');
                adminBtn.onclick = function () {
                    login.style.display = "block";
                    bg.style.display = "block";
                    return false;
                }
                //  .点击"关闭",隐藏登陆窗口和遮盖层
                var closeBtn = document.getElementById('closeBtn');
                closeBtn.onclick = function () {
                    login.style.display = "none";
                    bg.style.display = "none";
                    return false;
                }
                //  .鼠标拖拽功能
                var login_title = document.getElementById('login-title');
                login_title.onmousedown = function (e) {
                    e = e || window.event;
                    var x = e.pageX || e.clientX + (document.body.scrollLeft || document.documentElement.scrollLeft);
                    var y = e.pageY || e.clientY + (document.body.scrollTop || document.documentElement.scrollTop);

                    var boxX = login.offsetLeft;
                    var boxY = login.offsetTop;

                    var mouse_in_boxX = x - boxX;
                    var mouse_in_boxY = y - boxY;

                    document.onmousemove = function (e) {
                        var x = e.pageX || e.clientX + (document.body.scrollLeft || document.documentElement.scrollLeft);
                        var y = e.pageY || e.clientY + (document.body.scrollTop || document.documentElement.scrollTop);

                        login.style.left = x - mouse_in_boxX + +'px';
                        login.style.top = y - mouse_in_boxY - +'px';
                    }
                }

                login_title.onmouseup = function () {
                    document.onmousemove = null;
                }
            </script>
    </asp:Content>